<template>
  <div class="app-container">
    <el-dialog
      ref="fireDialoag"
      :title="dialogTitle"
      :visible.sync="open"
      class="open-container"
      @closed="closeDialog"
      :modal-append-to-body="false"
    >
      <el-form
        ref="jgForm"
        :rules="rules"
        :model="form"
        label-position="right"
        label-width="126px"
        class="dialogForm"
      >
        <table>
          <caption class="title">
            露天煤矿生产要素信息表
          </caption>
          <thead>
            <!-- 基本信息 -->
            <tr>
              <th class="label" colspan="6" style="border-bottom: 0px">
                基本信息
              </th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <el-form-item label="煤矿名称" prop="name">
                <td colspan="5" class="value th_label">
                  <el-input
                    class="elInput"
                    :readonly="type == 'detail'"
                    v-model="form.name"
                  ></el-input>
                </td>
              </el-form-item>
            </tr>
            <tr>
              <td class="label">企业性质</td>
              <td class="value" colspan="2" style="border-right: 0">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.enterpriseNature"
                ></el-input>
              </td>
              <el-form-item
                label="生产状态"
                prop="productionStatus"
                style="width: 241px; padding-left: 62px"
              >
                <td colspan="2" class="value td_select_label">
                  <el-select
                    class="select"
                    placeholder=""
                    v-model="form.productionStatus"
                    :disabled="type == 'detail'"
                  >
                    <el-option
                      v-for="li in productionStatus"
                      :key="li.value"
                      :label="li.value"
                      :value="li.id"
                    ></el-option>
                  </el-select>
                  <!-- <div class="detail_lable" v-else>
                    &nbsp;&nbsp;&nbsp;&nbsp;{{
                      productionStatusDetail[form.productionStatus]
                    }}
                  </div> -->
                </td>
              </el-form-item>
            </tr>
            <tr>
              <td class="label">详细地址</td>
              <td class="value" colspan="2">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.address"
                ></el-input>
              </td>
              <td class="label">经纬度</td>
              <td class="value" colspan="2">
                <el-input
                  :readonly="type == 'detail'"
                  placeholder="经纬度如：106.06 ；96.75"
                  v-model="form.latitudeAndLongitude"
                ></el-input>
              </td>
            </tr>
            <!-- 证照情况 -->
            <tr>
              <td class="label" colspan="6">证照情况</td>
            </tr>
            <tr>
              <td class="label">证照名称</td>
              <td class="label">证 号</td>
              <td class="label">发证机关</td>
              <td class="label">颁证日期</td>
              <td class="label">有效期</td>
              <td class="label">备注</td>
            </tr>
            <tr
              v-for="(item, ii) in form.cfeCoalminesBasicCertificateList"
              :key="item.name + ii"
            >
              <td class="label">{{ item.name }}</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="item.certificate"
                ></el-input>
              </td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="item.licenceIssuing"
                ></el-input>
              </td>
              <td class="value">
                <el-date-picker
                  value-format="yyyy-MM-dd hh:mm:ss"
                  v-model="item.issuanceTime"
                  type="date"
                  :readonly="type == 'detail'"
                  placeholder="选择日期"
                >
                </el-date-picker>
              </td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="item.validity"
                ></el-input>
              </td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="item.remark"
                ></el-input>
              </td>
            </tr>
            <!-- 开采基本条件 -->
            <tr>
              <td class="label" colspan="6">开采基本条件</td>
            </tr>
            <tr>
              <td class="label">投产时间</td>
              <td class="value">
                <el-date-picker
                  style="width: 137px"
                  value-format="yyyy-MM-dd hh:mm:ss"
                  v-model="form.productionTime"
                  type="date"
                  :readonly="type == 'detail'"
                  placeholder="选择日期"
                >
                </el-date-picker>
              </td>
              <td class="label">井田面积（km2）</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.miningArea"
                ></el-input>
              </td>
              <td class="label">核定生产能力（万吨/年）</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.productionCapacity"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">剩余地质储量</td>
              <td class="value" style="width: 137px">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.geologicalReserves"
                ></el-input>
              </td>
              <td class="label">剩余可采储量（万吨）</td>
              <td class="value" style="width: 137px">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.recoverable"
                ></el-input>
              </td>
              <td class="label">剩余服务年限(年)</td>
              <td class="value" style="width: 137px">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.serviceLife"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">煤种</td>
              <td class="value" style="width: 137px">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.coal"
                ></el-input>
              </td>
              <td class="label">当前开采台阶标高（米）</td>
              <td class="value" style="width: 137px">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.stepElevation"
                ></el-input>
              </td>
              <td class="label">限采水平标高（米）</td>
              <td class="value" style="width: 137px">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.limitedMining"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">可采煤层数量（层）</td>
              <td class="value" style="width: 137px">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.seamsNumber"
                ></el-input>
              </td>

              <td class="label">当前开采煤层编号</td>
              <td class="value" style="width: 137px">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.coalNumber"
                ></el-input>
              </td>
              <td class="label">剥离工艺</td>
              <td class="value" style="width: 137px">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.liftOff"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">剥离台阶高度（米）</td>
              <td class="value" style="width: 137px">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.stepHeight"
                ></el-input>
              </td>
              <td class="label">采煤工艺</td>
              <td class="value" style="width: 137px">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.miningTechnology"
                ></el-input>
              </td>
              <td class="label">采区划分</td>
              <td class="value" style="width: 137px">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.areaDivision"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">采煤台阶高度</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.miningSteps"
                ></el-input>
              </td>
              <td class="label">采掘场边坡角</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.slopeAngle"
                ></el-input>
              </td>
              <td class="label">采掘带宽度（米）</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.beltWidth"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">运输方式</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.transport"
                ></el-input>
              </td>
              <td class="label">排土场边坡角</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.dumpSlopeAngle"
                ></el-input>
              </td>
              <td class="label">实际剥采比</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.actualRatio"
                ></el-input>
              </td>
            </tr>
            <!-- 主要灾害类型鉴定结果 -->
            <tr>
              <td class="label" colspan="6">主要灾害类型鉴定结果</td>
            </tr>
            <tr>
              <td class="label">鉴定类型</td>
              <td class="label">鉴定结果</td>
              <td class="label" colspan="2">鉴定机构</td>
              <td class="label" colspan="2">鉴定时间</td>
            </tr>
            <tr
              v-for="(item, iii) in form.cfeCoalminesBasicDisastertypeList"
              :key="item.id + iii"
            >
              <td class="label">{{ item.identificationType }}</td>
              <!-- <td class="label">
                <el-input
                  :rows="2"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="item.identificationType"
                ></el-input>
              </td> -->
              <td class="label" colspan="1">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="item.identificationResults"
                ></el-input>
              </td>
              <td class="label" colspan="2">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="item.accreditingBodies"
                ></el-input>
              </td>
              <td class="label" colspan="2">
                <el-date-picker
                  style="width: 277px"
                  value-format="yyyy-MM-dd hh:mm:ss"
                  v-model="item.appraisalTime"
                  type="date"
                  :readonly="type == 'detail'"
                  placeholder="选择日期"
                >
                </el-date-picker>
              </td>
            </tr>

            <!-- 机构人员配备 -->
            <tr>
              <td class="label" colspan="6">机构人员配备</td>
            </tr>
            <tr>
              <td class="label">煤矿现有 <br />职工数量</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.employeesNumber"
                ></el-input>
              </td>
              <td class="label">管理人员 <br />数量</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.administrativeNumber"
                ></el-input>
              </td>
              <td class="label">工程技术<br />人员数量</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.engineeringNumber"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">特种作业 <br />人员数量</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.specialNumber"
                ></el-input>
              </td>
              <td class="label">采场定员 <br />人数</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.miningNumber"
                ></el-input>
              </td>
              <td class="label">排土场定员 <br />人数</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.dumpNumber"
                ></el-input>
              </td>
            </tr>

            <!-- 主要管理人员信息 -->
            <tr>
              <td class="label" colspan="6">主要管理人员信息</td>
            </tr>
            <tr>
              <td class="label">职务</td>
              <td class="label">姓名</td>
              <td class="label">专业</td>
              <td class="label">职称</td>
              <td class="label">所持安全管理<br />资格证编号</td>
              <td class="label">联系方式</td>
            </tr>
            <tr
              v-for="item in form.cfeCoalminesBasicManagementList"
              :key="item.id + 'person'"
            >
              <td class="label">{{ item.duties }}</td>

              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="item.peopleName"
                ></el-input>
              </td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="item.speciality"
                ></el-input>
              </td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="item.title"
                ></el-input>
              </td>
              <td class="value">
                <el-input
                  :rows="2"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="item.numberSafetyManagement"
                ></el-input>
              </td>
              <td class="value">
                <el-input
                  :rows="2"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="item.contact"
                ></el-input>
              </td>
            </tr>

            <!-- 安全保障 -->
            <tr>
              <td class="label" colspan="6">安全保障</td>
            </tr>
            <tr>
              <el-form-item
                label="标准化等级"
                prop="standardizationLevel"
                style="border: 0px solid; border-left: 1px solid"
              >
                <!-- <td colspan="2" class="value"> -->
                <el-select
                  style="width: 223px; margin-left: 5px; margin-top: 1px"
                  placeholder=""
                  class="select"
                  v-model="form.standardizationLevel"
                  :disabled="type == 'detail'"
                >
                  <el-option
                    v-for="li in standardizationLewel"
                    :key="li.id"
                    :label="li.value"
                    :value="li.id"
                  ></el-option>
                </el-select>
                <!-- <div class="detail_lable" v-else>
                  &nbsp; &nbsp; &nbsp; &nbsp;
                  {{ standardizationLewelDetail[form.standardizationLevel] }}
                </div> -->
                <!-- </td> -->
              </el-form-item>
              <td class="value" colspan="2" style="border-right: 0"></td>
              <td class="label">安全评价结论</td>
              <td class="value" colspan="2">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.safetyEvaluation"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label" colspan="6">前期手续办理情况</td>
            </tr>
            <tr>
              <td class="label">项目核准文号</td>
              <td class="value">
                <el-input
                  :rows="2"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="form.approvalNumber"
                ></el-input>
              </td>
              <td class="label">建设用地 <br />批复文号</td>
              <td class="value">
                <el-input
                  :rows="2"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="form.constructionNumber"
                ></el-input>
              </td>
              <td class="label">项目环境影响 <br />评价批复文号</td>
              <td class="value">
                <el-input
                  :rows="2"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="form.environmentalNumber"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">水土保持<br />批复文号</td>
              <td class="value">
                <el-input
                  :rows="2"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="form.waterNumber"
                ></el-input>
              </td>
              <td class="label">节能评估 <br />批复文号</td>
              <td class="value">
                <el-input
                  :rows="2"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="form.savingNumber"
                ></el-input>
              </td>
              <td class="label">初步设计 <br />评价批复文号</td>
              <td class="value">
                <el-input
                  :rows="2"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="form.preliminaryNumber"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">安全设施设计<br />批复文号</td>
              <td class="value">
                <el-input
                  :rows="2"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="form.safetyNumber"
                ></el-input>
              </td>
              <td class="label">消防安全 <br />批复文号</td>
              <td class="value" colspan="3">
                <el-input
                  :rows="2"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="form.fireNumber"
                ></el-input>
              </td>
            </tr>

            <!-- 参建单位及项目建设情况信息 -->
            <tr>
              <td class="label" colspan="6">参建单位及项目建设情况信息</td>
            </tr>
            <tr>
              <td class="label">设计单位</td>
              <td class="value" colspan="5">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.designUnit"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">施工单位</td>
              <td class="value" colspan="5">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.constructionUnit"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">监理单位</td>
              <td class="value" colspan="5">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.controlUnit"
                ></el-input>
              </td>
            </tr>
            <!-- 参建单位及项目建设情况信息 -->
            <tr>
              <td class="label" colspan="6">其他事项</td>
            </tr>
            <tr>
              <td class="label">停产停建<br />时间和原因</td>
              <td class="value" colspan="5">
                <el-input
                  :rows="5"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="form.suspensionReasons"
                ></el-input>
              </td>
            </tr>

            <tr>
              <td class="label">目前存在的<br />主要问题</td>
              <td class="value" colspan="5">
                <el-input
                  :rows="5"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="form.problems"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">其他需要<br />说明的事项</td>
              <td class="value" colspan="5">
                <el-input
                  :rows="5"
                  :readonly="type == 'detail'"
                  type="textarea"
                  v-model="form.otherExplanations"
                ></el-input>
              </td>
            </tr>
            <tr>
              <td class="label">填 表 人：</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.filledBy"
                ></el-input>
              </td>
              <td class="label">联系电话：</td>
              <td class="value">
                <el-input
                  :readonly="type == 'detail'"
                  v-model="form.telephone"
                ></el-input>
              </td>
              <td class="label">填表时间：</td>
              <td class="value">
                <el-date-picker
                  value-format="yyyy-MM-dd hh:mm:ss"
                  v-model="form.filledTime"
                  type="date"
                  :readonly="type == 'detail'"
                  placeholder="选择日期"
                >
                </el-date-picker>
              </td>
            </tr>
          </tbody>
        </table>
        <!-- <div class="lastTitle">
          <div class="lastPerson">填 表 人：</div>
          <div class="lastPersonContent"></div>
          <div class="lastPerson">联系电话：</div>
          <div class="lastPersonContent"></div>
          <div class="lastPerson">填 表 人：</div>
          <div class="lastPersonContent"></div>
        </div> -->
      </el-form>
      <div slot="footer" class="dialog-footer" v-show="type != 'detail'">
        <el-button
          type="primary"
          size="small"
          style="width: 108px"
          @click="submitHandler"
          >保 存</el-button
        >
        <el-button @click="cancel" size="small" style="width: 108px"
          >取 消</el-button
        >
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { addLouTian, updateLouTian } from "@/api/data/houtai";

export default {
  name: "FireDialoag",
  props: {
    dialogTitle: {
      type: String,
    },
    serviceRefresh: { type: Function, default: () => {} },
  },

  data() {
    return {
      rules: {
        name: [{ required: true, message: "请输入矿山名称", trigger: "blur" }],
        productionStatus: [
          { required: true, message: "请选择生产状态", trigger: "blur" },
        ],
        standardizationLevel: [
          { required: true, message: "请选择标准化等级", trigger: "blur" },
        ],
      },
      form: {
        id: undefined,
        name: "",
        enterpriseNature: null,
        productionStatus: 1,
        address: null,
        longitude: null,
        latitude: null,
        productionTime: null,
        miningArea: null,
        productionCapacity: null,
        geologicalReserves: null,
        recoverable: null,
        serviceLife: null,
        coal: null,
        seamsNumber: null,
        wellboreNumber: null,
        miningTechnology: null,
        areaDivision: null,
        miningSteps: null,
        slopeAngle: null,
        beltWidth: null,
        transport: null,
        stepHeight: null,
        dumpSlopeAngle: null,
        actualRatio: null,
        employeesNumber: null,
        administrativeNumber: null,
        engineeringNumber: null,
        specialNumber: null,
        miningNumber: null,
        safetyEvaluation: null,
        approvalNumber: null,
        constructionNumber: null,
        environmentalNumber: null,
        waterNumber: null,
        savingNumber: null,
        preliminaryNumber: null,
        safetyNumber: null,
        fireNumber: null,
        designUnit: null,
        controlUnit: null,
        suspensionReasons: null,
        problems: null,
        constructionUnit: null,
        standardizationLevel: null,
        otherExplanations: null,
        cfeCoalminesBasicCertificateList: [
          {
            name: "采矿许可证",
            certificate: "", //证号
            issuanceTime: "", //颁证日期
            licenceIssuing: "", //发证机关
            remark: "", //备注
            validity: "", //有效期
          },
          {
            name: "安全生产许可证",
            certificate: "",
            issuanceTime: "",
            licenceIssuing: "",
            remark: "",
            validity: "",
          },
          {
            name: "营业执照",
            certificate: "",
            issuanceTime: "",
            licenceIssuing: "",
            remark: "",
            validity: "",
          },
        ],
        cfeCoalminesBasicDisastertypeList: [
          {
            accreditingBodies: "", //鉴定机构
            appraisalTime: "", //鉴定时间
            id: 0,
            identificationResults: "", //鉴定结果
            identificationType: `地质构造复杂程度`, //鉴定类型
          },
          {
            accreditingBodies: "", //鉴定机构
            appraisalTime: "", //鉴定时间
            id: 1,
            identificationResults: "", //鉴定结果
            identificationType: `水文地质类型`, //鉴定类型
          },

          {
            accreditingBodies: "", //鉴定机构
            appraisalTime: "", //鉴定时间
            id: 4,
            identificationResults: "", //鉴定结果
            identificationType: "煤尘爆炸性", //鉴定类型
          },
          {
            accreditingBodies: "", //鉴定机构
            appraisalTime: "", //鉴定时间
            id: 5,
            identificationResults: "", //鉴定结果
            identificationType: `煤层自燃发火倾向`, //鉴定类型
          },
        ],
        cfeCoalminesBasicManagementList: [
          {
            contact: "", //联系方式
            duties: "法定代表人", //职务
            id: 1,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
          {
            contact: "", //联系方式
            duties: "矿    长", //职务
            id: 2,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
          {
            contact: "", //联系方式
            duties: "安全总监", //职务
            id: 3,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
          {
            contact: "", //联系方式
            duties: "总    工", //职务
            id: 4,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
          {
            contact: "", //联系方式
            duties: "安全矿长", //职务
            id: 5,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
          {
            contact: "", //联系方式
            duties: "机电矿长", //职务
            id: 6,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
          {
            contact: "", //联系方式
            duties: "生产矿长", //职务
            id: 7,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
        ],
        filledBy: null,
        filledTime: null,
        telephone: null,
        latitudeAndLongitude: "",
        dumpNumber: undefined,
        miningNumber: undefined,
      },
      open: false,
      type: "",
      // 文件类型, 例如['png', 'jpg', 'jpeg']
      fileType: ["doc", "xls", "ppt", "txt", "pdf", "png", "jpg", "jpeg"],
      //生产状态 1勘查 2设计 3生产 4闭坑
      productionStatus: [
        { id: 1, value: "勘查" },
        { id: 2, value: "设计" },
        { id: 3, value: "生产" },
        { id: 4, value: "闭坑" },
      ],
      productionStatusDetail: { 1: "勘查", 2: "设计", 3: "生产", 4: "闭坑" },
      //状态1建设2在用3 闭库
      status: [
        { id: 1, value: "建设" },
        { id: 2, value: "在用" },
        { id: 3, value: "闭库" },
      ],
      //尾矿库类型 1 山谷型 2 傍山型 3 平地型 4截河型
      types: [
        { id: 1, value: "山谷型" },
        { id: 2, value: "傍山型" },
        { id: 3, value: "平地型" },
        { id: 4, value: "截河型" },
      ],
      //安全保障标准化等级 1 一级 2 二级 3 三级
      standardizationLewel: [
        { id: 1, value: "一级" },
        { id: 2, value: "二级" },
        { id: 3, value: "三级" },
      ],
      standardizationLewelDetail: { 1: "一级", 2: "二级", 3: "三级" },
    };
  },
  methods: {
    resetData() {
      this.form = {
        id: undefined,
        name: "",
        enterpriseNature: null,
        productionStatus: null,
        address: null,
        longitude: null,
        latitude: null,
        productionTime: null,
        miningArea: null,
        productionCapacity: null,
        geologicalReserves: null,
        recoverable: null,
        serviceLife: null,
        coal: null,
        seamsNumber: null,
        wellboreNumber: null,
        miningTechnology: null,
        areaDivision: null,
        miningSteps: null,
        slopeAngle: null,
        beltWidth: null,
        transport: null,
        stepHeight: null,
        dumpSlopeAngle: null,
        actualRatio: null,
        employeesNumber: null,
        administrativeNumber: null,
        engineeringNumber: null,
        specialNumber: null,
        miningNumber: null,
        safetyEvaluation: null,
        approvalNumber: null,
        constructionNumber: null,
        environmentalNumber: null,
        waterNumber: null,
        savingNumber: null,
        preliminaryNumber: null,
        safetyNumber: null,
        fireNumber: null,
        designUnit: null,
        controlUnit: null,
        suspensionReasons: null,
        problems: null,
        constructionUnit: null,
        standardizationLevel: null,
        otherExplanations: null,
        cfeCoalminesBasicCertificateList: [
          {
            name: "采矿许可证",
            certificate: "", //证号
            issuanceTime: "", //颁证日期
            licenceIssuing: "", //发证机关
            remark: "", //备注
            validity: "", //有效期
          },
          {
            name: "安全生产许可证",
            certificate: "",
            issuanceTime: "",
            licenceIssuing: "",
            remark: "",
            validity: "",
          },
          {
            name: "营业执照",
            certificate: "",
            issuanceTime: "",
            licenceIssuing: "",
            remark: "",
            validity: "",
          },
        ],
        cfeCoalminesBasicDisastertypeList: [
          {
            accreditingBodies: "", //鉴定机构
            appraisalTime: "", //鉴定时间
            id: 0,
            identificationResults: "", //鉴定结果
            identificationType: `地质构造复杂程度`, //鉴定类型
          },
          {
            accreditingBodies: "", //鉴定机构
            appraisalTime: "", //鉴定时间
            id: 1,
            identificationResults: "", //鉴定结果
            identificationType: `水文地质类型`, //鉴定类型
          },

          {
            accreditingBodies: "", //鉴定机构
            appraisalTime: "", //鉴定时间
            id: 4,
            identificationResults: "", //鉴定结果
            identificationType: "煤尘爆炸性", //鉴定类型
          },
          {
            accreditingBodies: "", //鉴定机构
            appraisalTime: "", //鉴定时间
            id: 5,
            identificationResults: "", //鉴定结果
            identificationType: `煤层自燃发火倾向`, //鉴定类型
          },
        ],
        cfeCoalminesBasicManagementList: [
          {
            contact: "", //联系方式
            duties: "法定代表人", //职务
            id: 1,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
          {
            contact: "", //联系方式
            duties: "矿    长", //职务
            id: 2,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
          {
            contact: "", //联系方式
            duties: "安全总监", //职务
            id: 3,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
          {
            contact: "", //联系方式
            duties: "总    工", //职务
            id: 4,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
          {
            contact: "", //联系方式
            duties: "安全矿长", //职务
            id: 5,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
          {
            contact: "", //联系方式
            duties: "机电矿长", //职务
            id: 6,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
          {
            contact: "", //联系方式
            duties: "生产矿长", //职务
            id: 7,
            peopleName: "", //姓名

            numberSafetyManagement: "", //所持安全管理资格证编号
            speciality: "", //专业
            title: "", //职称
          },
        ],
        filledBy: null,
        filledTime: null,
        telephone: null,
        latitudeAndLongitude: "",
        dumpNumber: undefined,
        miningNumber: undefined,
      };
      this.type = "";
    },
    openDialog(type, row) {
      this.resetData();
      this.open = true;
      this.type = type;
      if (this.type != "create") {
        this.form = Object.assign({}, row);
        // if (row.latitude || row.longitude) {
        //   this.form.latitudeAndLongitude = row.longitude + "," + row.latitude;
        // }
      }
    },
    closeDialog() {
      this.open = false;
      this.resetData();
    },

    valadateData() {
      if (this.form.miningArea && isNaN(Number(this.form.miningArea))) {
        this.$modal.msgError("井田面积必须为数字");
        return false;
      }
      if (
        this.form.productionCapacity &&
        isNaN(Number(this.form.productionCapacity))
      ) {
        this.$modal.msgError("核定生产能力必须为数字");
        return false;
      }
      if (
        this.form.geologicalReserves &&
        isNaN(Number(this.form.geologicalReserves))
      ) {
        this.$modal.msgError("剩余地质储量必须为数字");
        return false;
      }
      if (this.form.recoverable && isNaN(Number(this.form.recoverable))) {
        this.$modal.msgError("剩余可采储量必须为数字");
        return false;
      }
      if (this.form.serviceLife && isNaN(Number(this.form.serviceLife))) {
        this.$modal.msgError("剩余服务年限必须为数字");
        return false;
      }
      if (this.form.stepElevation && isNaN(Number(this.form.stepElevation))) {
        this.$modal.msgError("当前开采台阶标高必须为数字");
        return false;
      }
      if (this.form.limitedMining && isNaN(Number(this.form.limitedMining))) {
        this.$modal.msgError("限采水平标高必须为数字");
        return false;
      }
      if (this.form.seamsNumber && isNaN(Number(this.form.seamsNumber))) {
        this.$modal.msgError("可采煤层数量必须为数字");
        return false;
      }
      if (this.form.dumpSlopeAngle && isNaN(Number(this.form.dumpSlopeAngle))) {
        this.$modal.msgError("排土场边坡角必须为数字");
        return false;
      }
      if (this.form.beltWidth && isNaN(Number(this.form.beltWidth))) {
        this.$modal.msgError("采掘场边坡角必须为数字");
        return false;
      }

      if (this.form.miningSteps && isNaN(Number(this.form.miningSteps))) {
        this.$modal.msgError("采煤台阶高度必须为数字");
        return false;
      }
      // if (this.form.actualRatio && isNaN(Number(this.form.actualRatio))) {
      //   this.$modal.msgError("回采面数量（个）必须为数字");
      //   return false;
      // }
      if (
        this.form.employeesNumber &&
        isNaN(Number(this.form.employeesNumber))
      ) {
        this.$modal.msgError("煤矿现有职工数量必须为数字");
        return false;
      }
      if (
        this.form.administrativeNumber &&
        isNaN(Number(this.form.administrativeNumber))
      ) {
        this.$modal.msgError("管理人员数量必须为数字");
        return false;
      }
      if (
        this.form.engineeringNumber &&
        isNaN(Number(this.form.engineeringNumber))
      ) {
        this.$modal.msgError("工程技术人员数量必须为数字");
        return false;
      }
      if (this.form.specialNumber && isNaN(Number(this.form.specialNumber))) {
        this.$modal.msgError("特种作业人员数量必须为数字");
        return false;
      }
      if (this.form.miningNumber && isNaN(Number(this.form.miningNumber))) {
        this.$modal.msgError("采场定员人数必须为数字");
        return false;
      }
      if (this.form.dumpNumber && isNaN(Number(this.form.dumpNumber))) {
        this.$modal.msgError("排土场定员人数必须为数字");
        return false;
      }

      return true;
    },
    //弹框提交处理
    submitHandler() {
      if (this.form.latitudeAndLongitude) {
        const arr = this.form.latitudeAndLongitude.split("；");
        if (arr.length == 2) {
          this.form.longitude = Number(arr[0]);
          this.form.latitude = Number(arr[1]);
        }
      }
      const that = this;
      this.$refs["jgForm"].validate((valid) => {
        if (valid) {
          if (that.valadateData()) {
            if (that.type === "edit") {
              // 编辑
              updateLouTian(that.form).then(() => {
                //刷新列表
                that.serviceRefresh();
                //关闭弹框
                that.closeDialog();
                that.$modal.msgSuccess("修改成功");
              });
            } else if (that.type === "create") {
              //创建
              addLouTian(that.form).then(() => {
                //刷新列表
                that.serviceRefresh();
                //关闭弹框
                that.closeDialog();
                that.$modal.msgSuccess("新增成功");
              });
            }
          }
        }
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
    },
  },
};
</script>
<style lang="scss" scoped>
table {
  width: 100%;
  // border: 1px solid;
  margin-top: -62px;
  border-collapse: collapse;
  .title {
    font-size: 30px;
    margin: 20px;
  }
  th {
    width: 120px;
    height: 35px;
    text-align: center;
    font-size: 15px;
    border: 1px solid;
  }
  td {
    width: 180px;
    height: 35px;
    text-align: center;
    font-size: 15px;
    border: 1px solid;
  }
  .label {
    font-family: "AlibabaPuHuiTi-2-85-Bold";
    font-size: 16px;
    font-weight: normal;
    font-stretch: normal;
    letter-spacing: 1px;
    width: 125px;
  }
  .value {
    font-family: "AlibabaPuHuiTi-2-55-Regular";
    font-size: 14px;
    font-weight: normal;
    font-stretch: normal;
    letter-spacing: 1px;
  }
  .threeHeight {
    height: 105px;
  }
  .twoHeight {
    height: 70px;
  }
  .fujian {
    font-family: "AlibabaPuHuiTi-2-85-Bold";
    font-size: 16px;
    // display: flex;
    // justify-content: flex-start;
    // flex-direction: column;
  }
  .elInput {
    position: absolute;
    left: 1px;
    top: 0;
    width: 780px;
  }
  .th_label,
  .td_label {
    position: absolute;
    left: 1px;
    width: 783px;
    top: -1px;
    height: 37px;
    border-bottom: 0px;
    border-left: 0;
  }
  .td_select_label {
    position: absolute;
    left: 51px;
    width: 310px;
    top: -1px;
    height: 39px;
    border-bottom: 0px;
  }
  .select {
    width: 300px;
    position: absolute;
    top: 1px;
    left: 1px;
  }
  .detail_lable {
    text-align: left;
  }
}

.dialog-footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 66px;
  background: #e5e5e5;
  left: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding-right: 200px;
}
::v-deep .el-dialog:not(.is-fullscreen) {
  margin-top: 80px !important;
  z-index: 1000007 !important;
}

::v-deep .el-form-item {
  margin-bottom: 0;
  // border-left: 1px solid;
  // border-top: 1px solid;
  // border-right: 1px solid;
  // margin-left: 0;
  margin-left: 0;
  border: 1px solid;
  border-bottom: 0;
  ::v-deep .el-form-item__content {
    margin-left: 110px;
  }

  ::v-deep .el-input__inner {
    height: 34px;
    line-height: 34px;
  }
}
::v-deep .el-form-item__label {
  border-bottom: 0px;
  font-family: "AlibabaPuHuiTi-2-85-Bold";
  font-size: 16px;
  font-weight: normal;
  font-stretch: normal;
  letter-spacing: 1px;
  text-align: center;
}
::v-deep .el-form-item__error {
  color: #ff4949;
  font-size: 14px;
  position: absolute;
  top: 100%;
  left: 20px;
  width: 160px;
  z-index: 1;
  display: none;
}
</style>
